package Leetcode第一期;

public class 两个链表的第一个公共节点_52 {

    public class Solution {
        public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
            ListNode N1=headA;
            ListNode N2=headB;
            while (N1!=N2){
                N1= (N1==null?headB:N1.next);
                N2= (N2==null?headA:N2.next);
            }
            return N1;
        }

    }

}
